<?php
require('lib/verify.php');
require('lib/has_char.php');
require('lib/is_approved.php');

$raid_id = $_GET["id"];
$sql = "select *, wm_instances.* from wm_raids left join wm_instances on wm_instances.instance_id = raid_instance where raid_id = $raid_id";
$result = $db->query($sql);


if($db->num_rows($result)<1) {
 header("Location: error-wrong-system.php");
 exit;
}


$raid = $db->fetch_assoc($result);

$_category = "warmath";
$_title = "Raid / " . $raid["instance_name"] . ", " . date("D d M Y", strtotime($raid["raid_date"]));
require('lib/head.php');


boxTop("Warmath: $_title");

?>
<?php
  $sql = "select *, wm_bosses.* from wm_credits left join wm_bosses on wm_bosses.boss_id = credit_boss where credit_raid = '" . $raid["raid_id"] . "' order by credit_date asc";
  $res = $db->query($sql);
  
?>

<a href="loot-instance.php?id=<?=$raid["instance_id"]?>"><b><?=$raid["instance_name"]?></b></a>, <?=date("D d M Y", strtotime($raid["raid_date"]))?> <b>T<?=$system["system_tier"]?>R<?=$raid["raid_id"]?></b>
<?php
   if($character["character_admin"]) {
     ?>
     (<?adminfeature()?> <a href="add-credit.php?id=<?=$raid["raid_id"]?>">add a credit</a>)
<?php
     $sql = "select * from wm_credits where credit_raid = " . $raid["raid_id"];
     $resa = $db->query($sql);
     if($db->num_rows($resa)==0) {
     ?>
 (<?adminfeature()?> <a href="remove-raid.php?id=<?=$raid["raid_id"]?>">remove this raid</a>) 
<?php
     }
   }
?>

<br />
<?php
   while($cred = $db->fetch_assoc($res)) {
?>
   &nbsp;   &nbsp;   &nbsp;<a href="credit.php?id=<?=$cred["credit_id"]?>"><?=$cred["boss_name"]?>, <?=date("g:i a", strtotime($cred["credit_date"]))?></a><br />
<?php
   }
?>


<?php
boxBot();
?>

<?php
require('lib/foot.php');
?>

